package com.example.seataxa.account.controller;

import com.example.seataxa.account.service.AccountService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.alibaba.nacos.client.utils.EnvUtil.LOGGER;

/**
 * @author 季舟
 * @Date 2024-09-14 14:49
 */
@RestController
public class AccountController {
    @Resource
    private AccountService accountService;

    @RequestMapping(value = "/debit", method = RequestMethod.GET, produces = "application/json")
    public String debit(String userId, int money) {
        try {
            accountService.debit(userId, money);
        } catch (Exception ex) {
            LOGGER.error("debit err,", ex);
            throw ex;
        }
        return "SUCCESS";
    }

}
